\hypertarget{class_udp_socket}{\section{Udp\+Socket类 参考}
\label{class_udp_socket}\index{Udp\+Socket@{Udp\+Socket}}
}


Udp\+Socket类  




{\ttfamily \#include $<$Socket.\+h$>$}

类 Udp\+Socket 继承关系图\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{class_udp_socket}
\end{center}
\end{figure}
\subsection*{Public 成员函数}
\begin{DoxyCompactItemize}
\item 
sint32 \hyperlink{class_udp_socket_adeb843035b3b20bddd617bc654fe3979}{open} ()
\begin{DoxyCompactList}\small\item\em 打开\+U\+D\+P socket \end{DoxyCompactList}\item 
sint32 \hyperlink{class_udp_socket_a579acf9700828b5e1c030b37475ec7ea}{close} ()
\begin{DoxyCompactList}\small\item\em 关闭\+U\+D\+P socket \end{DoxyCompactList}\item 
sint32 \hyperlink{class_udp_socket_abf2e037e8419d7a0de52f18f61a17515}{read\+Data} (char $\ast$buf, sint32 len, sint32 timeout\+Ms=-\/1)
\begin{DoxyCompactList}\small\item\em U\+D\+P socket接收数据 \end{DoxyCompactList}\item 
sint32 \hyperlink{class_udp_socket_a1514ecb7ac2363283870cf064df83c25}{write\+Data} (const char $\ast$buf, sint32 len, sint32 timeout\+Ms=-\/1)
\begin{DoxyCompactList}\small\item\em U\+D\+P socket发送数据 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{额外继承的成员函数}


\subsection{详细描述}
Udp\+Socket类 

\subsection{成员函数说明}
\hypertarget{class_udp_socket_a579acf9700828b5e1c030b37475ec7ea}{\index{Udp\+Socket@{Udp\+Socket}!close@{close}}
\index{close@{close}!Udp\+Socket@{Udp\+Socket}}
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Udp\+Socket\+::close (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_udp_socket_a579acf9700828b5e1c030b37475ec7ea}


关闭\+U\+D\+P socket 


\begin{DoxyParams}{参数}
{\em void} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


重载 \hyperlink{class_socket_a1fe4c90416cad39e96049019d178fb37}{Socket} .

\hypertarget{class_udp_socket_adeb843035b3b20bddd617bc654fe3979}{\index{Udp\+Socket@{Udp\+Socket}!open@{open}}
\index{open@{open}!Udp\+Socket@{Udp\+Socket}}
\subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Udp\+Socket\+::open (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_udp_socket_adeb843035b3b20bddd617bc654fe3979}


打开\+U\+D\+P socket 


\begin{DoxyParams}{参数}
{\em void} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


实现了 \hyperlink{class_socket}{Socket}.

\hypertarget{class_udp_socket_abf2e037e8419d7a0de52f18f61a17515}{\index{Udp\+Socket@{Udp\+Socket}!read\+Data@{read\+Data}}
\index{read\+Data@{read\+Data}!Udp\+Socket@{Udp\+Socket}}
\subsubsection[{read\+Data}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Udp\+Socket\+::read\+Data (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{buf, }
\item[{sint32}]{len, }
\item[{sint32}]{timeout\+Ms = {\ttfamily -\/1}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_udp_socket_abf2e037e8419d7a0de52f18f61a17515}


U\+D\+P socket接收数据 


\begin{DoxyParams}{参数}
{\em buf} & 接收缓存 \\
\hline
{\em len} & 缓存大小 \\
\hline
{\em timeout\+Ms} & 超时时间,-\/1\+:阻塞,0\+:立即返回,$>$0\+:超时时间ms \\
\hline
{\em peer\+Addr} & 对端\+I\+P地址 \\
\hline
{\em peer\+Port} & 对端端口 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回接收的数据长度,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


实现了 \hyperlink{class_socket}{Socket}.

\hypertarget{class_udp_socket_a1514ecb7ac2363283870cf064df83c25}{\index{Udp\+Socket@{Udp\+Socket}!write\+Data@{write\+Data}}
\index{write\+Data@{write\+Data}!Udp\+Socket@{Udp\+Socket}}
\subsubsection[{write\+Data}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Udp\+Socket\+::write\+Data (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{data, }
\item[{sint32}]{len, }
\item[{sint32}]{timeout\+Ms = {\ttfamily -\/1}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_udp_socket_a1514ecb7ac2363283870cf064df83c25}


U\+D\+P socket发送数据 


\begin{DoxyParams}{参数}
{\em data} & 发送数据缓存 \\
\hline
{\em len} & 缓存大小 \\
\hline
{\em timeout\+Ms} & 超时时间,-\/1\+:阻塞,0\+:立即返回,$>$0\+:超时时间ms \\
\hline
{\em peer\+Addr} & 对端\+I\+P地址 \\
\hline
{\em peer\+Port} & 对端端口 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回发送的数据长度,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


实现了 \hyperlink{class_socket}{Socket}.



该类的文档由以下文件生成\+:\begin{DoxyCompactItemize}
\item 
libemb/inc/\hyperlink{_socket_8h}{Socket.\+h}\item 
libemb/src/Socket.\+cpp\end{DoxyCompactItemize}
